package co.th.bjc.md.utils;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class BusinessUtils {
	static ApplicationContext appContext;

	static void init() {
		appContext = new ClassPathXmlApplicationContext("resources/spring/config/BeanLocations.xml");

	}

	public static Object getService(String service_name) {
		try {
			if (appContext == null) {
				BusinessUtils.init();
			}
			return appContext.getBean(service_name);
		} catch (Exception ex) {
			ex.printStackTrace();
			return null;
		}
	}
	
	public static void getInstance() {
		try {
			if (appContext == null) {
				BusinessUtils.init();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
	
	public static String LOGIN_BUSINESS = "loginBusiness";
	public static String TEST_BUSINESS = "testBusiness";
	public static String CUSTOMER_BUSINESS = "customerBusiness";
}
